package cheme.ProcessEditor.Actions;

import org.eclipse.gef.ui.actions.ActionBarContributor;
import org.eclipse.gef.ui.actions.DeleteRetargetAction;
import org.eclipse.gef.ui.actions.RedoRetargetAction;
import org.eclipse.gef.ui.actions.UndoRetargetAction;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.actions.ActionFactory;

/**
 * Contributes actions to the Editor
 * 
 * @author Phil Zoio
 */
public class ChemeActionBarContributor extends ActionBarContributor
{

	FlyoutChangeLayoutAction changeLayoutAction;
	IEditorPart editor;
	
	protected void buildActions()
	{
		addRetargetAction(new UndoRetargetAction());
		addRetargetAction(new RedoRetargetAction());
		addRetargetAction(new DeleteRetargetAction());
		
//		addRetargetAction((RetargetAction)ActionFactory.CUT.create(editor.getSite().getWorkbenchWindow()));
//		addRetargetAction((RetargetAction)ActionFactory.COPY.create(editor.getSite().getWorkbenchWindow()));
//		addRetargetAction((RetargetAction)ActionFactory.PASTE.create(editor.getSite().getWorkbenchWindow()));
	}

	public void contributeToToolBar(IToolBarManager toolBarManager)
	{
		toolBarManager.add(getAction(ActionFactory.UNDO.getId()));
		toolBarManager.add(getAction(ActionFactory.REDO.getId()));

//		toolBarManager.add(getAction(ActionFactory.COPY.getId()));
//		toolBarManager.add(getAction(ActionFactory.CUT.getId()));
//		toolBarManager.add(getAction(ActionFactory.PASTE.getId()));
	}

	public void setActiveEditor(IEditorPart editor)
	{
		this.editor = editor;
		changeLayoutAction.setActiveEditor(editor);
		super.setActiveEditor(editor);
		
	}

	protected void declareGlobalActionKeys()
	{
		//add support for printing
//		addGlobalActionKey(IWorkbenchActionConstants.PRINT);
	}

//	private static ImageDescriptor create(String iconPath, String name)
//	{
//		return AbstractUIPlugin.imageDescriptorFromPlugin("com.realpersist.gef.schemaeditor", iconPath + name);
//	}



}